<%--
  Created by IntelliJ IDEA.
  User: 26832
  Date: 2024/4/15
  Time: 15:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login</title>
    <!-- 引入jQuery库（可从CDN获取，或者在项目中已包含） -->
    <style>        /* 重置默认样式 */
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    /* 全局样式 */
    body {
        font-family: 'Open Sans', sans-serif;
        background-color: #f4f4f4;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        overflow: hidden;
    }

    /* 登录框容器 */
    .container {
        width: 360px;
        background-color: #ffffff;
        border-radius: 10px;
        box-shadow: 0 9px 1.5rem rgba(0, 0, 0, 0.1);
        overflow: hidden;
        transition: transform 0.3s ease-in-out;
    }

    /* 登录框聚焦时添加微动效 */
    .container:focus-within {
        transform: translateY(-1rem);
    }

    /* 标题 */
    h2 {
        text-align: center;
        font-size: 24px;
        font-weight: bold;
        color: #333;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }

    /* 输入框 */
    input {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid #ccc;
        border-radius: 5px;
        font-size: 16px;
        background-color: #f7f7f7;
        transition: border-color 0.2s ease-in-out;

        /* 清除内边距以适应容器 */
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* 输入框聚焦时样式 */
    input:focus {
        outline: none;
        border-color: #007bff;
    }

    /* 登录按钮 */
    button {
        width: 100%;
        padding: 12px 16px;
        border: none;
        border-radius: 5px;
        background-color: #007bff;
        color: #fff;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
        transition: background-color 0.2s ease-in-out;
    }

    /* 登录按钮悬停与点击时样式 */
    button:hover,
    button:active {
        background-color: #0056b3;
    }

    </style>
</head>
<body>
<div class="container">
    <h2>Login</h2>
    <form id="loginForm" action="./login" method="post">
        <input type="text" name="username" id="username" placeholder="Username">
        <input type="password" name="password" id="password" placeholder="Password">
        <button type="submit">Login</button>
    </form>
</div>
<%
    //获取session中的属性值
    String msg = (String) session.getAttribute("msg");
    String div_state= "none";
    if(msg!=null){
        div_state = "block";
    }
%>
<div class="msgx" style = "display: <%=div_state%>;" >
    <p id="msgp" style="color: red">
        <%=msg%>
    </p>
</div>
<script>
    //设置msg5秒后消失


    //刷新页面

        window.addEventListener("load", function() {
            setTimeout(function () {
                document.querySelector(".msgx").style.display = "none";
            }, 5000);
    });


</script>
</body>
</html>
